home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2340 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: erich.triumf.ca!bennett
  2. From: bennett@erich.triumf.ca (P.Bennett)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Problem with ascii to number conversion.
  5. Date: 20 Jan 1996 09:56 PST
  6. Organization: TRIUMF: Tri-University Meson Facility
  7. Distribution: world
  8. Message-ID: <20JAN199609563071@erich.triumf.ca>
  9. References: <96012012081730705@busilink.com>
  10. NNTP-Posting-Host: ftp.triumf.ca
  11. News-Software: VAX/VMS VNEWS 1.50    
  12.  
  13. In article <96012012081730705@busilink.com>, paul.kelley@busilink.com (Paul Kelley) writes...
  14. >Hi,
  15. > i am a beginner c programmer, stuck on what i thought was a simple
  16. >problem. I have an ascii input file that contains payroll info for a
  17. >month, the data is monetary values as ascii strings. I am trying to
  18. >convert the ascii ti numbers total the result then place in another
  19. >file. I am using micrsoft quick C and the ascii to number functions in
  20. >it. Apparenntly these functions only work correctly up to four digits.
  21. >After that teh ouput goes wild.
  22.  
  23. A widely used commercial product like Micro$oft, unlikely to have this sort of
  24. a bug, so it is probably your program.  The problem would be easier to resolve
  25. if you had showed some source code.
  26.  
  27. However, "4 digits" sounds suspiciously like the size of a pointer in some
  28. memory models...
  29.  
  30. If you area reading the numbers from the file with fscanf(), remember that
  31. fscanf() requires the _address_ of a variable, like:
  32.     float f;
  33.     fscanf(file, "%f", &f);
  34.  
  35. Peter Bennett VE7CEI                | Vessels shall be deemed to be in sight
  36. Internet: bennett@triumf.ca         | of one another only when one can be
  37. Packet: ve7cei@ve7kit.#vanc.bc.ca   | observed visually from the other
  38. TRIUMF, Vancouver, B.C., Canada     |                          ColRegs 3(k)
  39. GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
  40.  
  41.  
  42.  
  43.  
  44.  
  45.